package com.dgh.school.mapper;


import com.dgh.school.bean.Paper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PaperMapper {

    @Select("select * from file")
    List<Paper> selectAll() throws Exception;

    // 根据id删除数据
    @Delete("delete from file where fid = #{id}")
    void deleteById(int id) throws Exception;

    // 插入数据
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into file values (default,#{fname},#{ftype},#{fdepartment})")
    void insert(Paper paper) throws Exception;


    @Update("update file set fname = #{fname},ftype = #{ftype},fdepartment = #{fdepartment} where fid = #{fid}")
    void update(Paper paper) throws Exception;

}
